|
자바예제모음 |
[1] |
|
등록일:2008-05-08 09:54:17 (0%) 작성자: 제목:메서드를 이용한 (2,8,10,16)진수 변환 |
|
class BinOctHex
{
public static void main (String[] args)
{
int a=0xC; //16진수 직접입력
int b=10; //10진수
int c=023; //8진수 직접입력
//2진수의 직접입력은 안되더군요 ^^;; 방법 알고 계신분은 덧글에 남겨주시는 센스!!
System.out.println("10진수 a,b,c = "+a+" "+b+" "+c);
System.out.println("2진수 a = "+Integer.toBinaryString(a));
System.out.println("2진수 b = "+Integer.toBinaryString(b));
System.out.println("2진수 c = "+Integer.toBinaryString(c));
System.out.println("8진수 a = "+Integer.toOctalString(a));
System.out.println("8진수 b = "+Integer.toOctalString(b));
System.out.println("8진수 c = "+Integer.toOctalString(c));
System.out.println("16진수 a = "+Integer.toHexString(a));
System.out.println("16진수 b = "+Integer.toHexString(b));
System.out.println("16진수 c = "+Integer.toHexString(c));
}
} |
[본문링크] 메서드를 이용한 (2,8,10,16)진수 변환
|
[1]
|
|
|
|
|
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=7523 |
|
|
|
|
|
|
|
|
|
Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.
|
|
|